#include<iostream>
using namespace std;
class A
{
public:
	virtual void fun()
	{
		cout << "A" << endl;
	}
	int a=1;
};
class B : virtual public A
{
public:
	virtual void fun()
	{
		cout << "B" << endl;
	}
	int b=2;
};
class C : virtual public A
{
public:
	virtual void fun()
	{
		cout << "C" << endl;
	}
	int c=3;
};
class D : public B,public C
{
public:
	virtual void fun()
	{
		cout << "D" << endl;
	}
	int d=4;
};
int main()
{
	D d;
	
	cout<<d.a<<endl;
	B & b= d;
	b.a = 9;
	C& c = d;
	c.a = 0;
	cout << d.a << endl;
	return 0;
}